from selenium import webdriver
from selenium.webdriver.common.by import By

#打开谷歌,打开so浏览器
driver = webdriver.Chrome()
driver.get("https://www.sogou.com/")

# XPATH层级定位到第一个input
form=driver.find_element(By.XPATH,"//form/input[1]")
print(form.get_attribute('outerHTML'))
# XPATH层级定位到第二个input
forms=driver.find_element(By.XPATH,"//form/input[2]")
print(forms.get_attribute('outerHTML'))


driver.quit()